﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Security.Permissions;
using TreasureJunk.Bl;

namespace TreasureJunk.Handler
{
    /// <summary>
    /// Summary description for RequestService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class RequestService : System.Web.Services.WebService
    {

        [WebMethod(true, EnableSession = true)]
        [PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
        public object LoadAnalytics(DateTime fromDate, DateTime toDate, int chartCate)
        {
            return ReportImpl.Instance.LoadAnalytics(fromDate, toDate, (ChartCategory)chartCate, 10, 1);
        }

        [WebMethod(true, EnableSession = true)]
        [PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
        public object LoadTopCategory(DateTime fromDate, DateTime toDate, int chartCate)
        {
            return ReportImpl.Instance.LoadAnalyticsByCategory(fromDate, toDate, (ChartCategory)chartCate, 10, 1);
        }

        [WebMethod(true, EnableSession = true)]
        [PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
        public object LoadAllCategory(DateTime fromDate, DateTime toDate, int chartCate)
        {
            return ReportImpl.Instance.LoadAnalyticsByCategory(fromDate, toDate, (ChartCategory)chartCate, null, null);
        }
    }
}
